package com.wxapp.sale.service.util;

import com.wxapp.common.util.date.DateTimeUtil;
import com.wxapp.sale.api.enums.order.OrderTypeEnum;

import java.time.LocalDateTime;

/**
 * @author lgl
 */
public class RandomUtil {

    public static String getOrderCode(OrderTypeEnum type) {
        if (type==null){
            return null;
        }
        StringBuilder code = new StringBuilder();
        switch (type) {
            case ORDINARY -> code.append("O");
        }
        code.append(DateTimeUtil.getTimeStamp(LocalDateTime.now()));
        code.append(com.wxapp.common.util.random.RandomUtil.getCommonRandom(6));
        return code.toString();
    }

    public static void main(String[] args) {
        System.out.println(getOrderCode(OrderTypeEnum.ORDINARY));

    }
}
